package org.oos.dao.options;

import java.util.ArrayList;
import java.util.List;

import com.google.api.client.util.Key;

/**
 * Defines the options that can be used to filter the search.
 * 
 * TODO: need to work with the tags and categories. Multiple attributes not
 * supported yet.
 * 
 * @author pablo.gonzalez@11870.com
 * 
 */
public class FilterOptions extends OptionsMap {

	public enum Scope {
		GLOBAL, USER, CONTACTS;
	}

	@Key("category")
	private List<String> categories = new ArrayList<String>();
	@Key("categoryGroup")
	private List<String> categoryGroups = new ArrayList<String>();
	@Key("attribute")
	private List<String> attributes = new ArrayList<String>();

	public void addCategory(String category) {
		categories.add(category);
	}

	public void addAttribute(String attribute) {
		attributes.add(attribute);
	}

	public boolean removeCategory(String category) {
		return categories.remove(category);
	}
	
	public boolean removeAttribute(String attribute) {
		return attributes.remove(attribute);
	}
	
	public boolean removeCategoryGroup(String categoryGroup) {
		return categoryGroups.remove(categoryGroup);
	}

	@Override
	public void clear() {
		categories.clear();
		attributes.clear();
	}

	public void addCategoryGroup(String categoryGroup) {
		categoryGroups.add(categoryGroup);
	}

}
